package demo1;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-10-31
 * Time: 10:08
 */
public class Demo0 {
    private static int flag = 0;

    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            while (flag == 0){

            }
            System.out.println("t1线程结束");
        });


        Thread t2 = new Thread(()->{
            Scanner in = new Scanner(System.in);
            System.out.println("请输入flag的值");
            flag = in.nextInt();
        });

        t1.start();
        t2.start();
    }
}
